package com.xiweicheng.test.springboot.im.admin.entity.security;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "user_authorities")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserAuthority implements Serializable {

    private static final long serialVersionUID = 795999893716682934L;

    @Id
    @GeneratedValue
    private Long id;

    @Column(name = "authority", nullable = false, length = 50)
    private String authority;

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", nullable = false)
    private User user;

}
